** estimate effects for each cognitive domain 

***Inputs: 
* $Data/GameUserWPdaily_norm.dta
* $Data/maxmindirectionsmonth_zip260.dta


***Outputs: 
* $Results/byeducation.png


	
	use $Data/GameUserWPdaily_norm.dta, clear
	
	gen month = month(date)

		
	gen zip2 = int( zip/10)
	
	merge m:1 zip2 month using $Data/maxmindirectionsmonth_zip260.dta
	
	keep if _merge ==3
	
	
	gen monthyear = mofd(date)

	gen highpm =  weighted_dailypm > 25 & weighted_dailypm<. 
	
	egen cut_winddirection = cut(median_closestwind), at(0(60)360)
	replace cut_winddirection = 0 if median_closestwind ==360

	gen maxzipwind = (cut_winddirection ==maxdirection )
	replace maxzipwind = . if maxdirection==.
	
	keep if maxzipwind<. 
	
	
	egen cut_temp = cut(weighted_temperature), at(-40(10)40)

	
	gen educthree = 1 if education_level == 1 | education_level==2 | education_level == 3 | education_level== 8
	
	replace educthree = 2 if education_level == 4 
	
	replace educthree = 3 if education_level == 5 | education_level == 6 | education_level == 7
	
	label define educthree 1 "< College" 2 "Bachelor" 3 "Post-graduate"
	label values educthree educthree
	
		
		
		
	ivreghdfe norm_score (c.highpm#i.educthree =c.maxzipwind#i.educthree ) weighted_wind_speed weighted_precipitation  , absorb(anon_id monthyear cut_temp ) cluster(anon_id monthyear)

		eststo educthree
		
		
	
		coefplot (educthree, keep(1.educthree#c.highpm) ciopts(recast(rcap) lcolor(red%30))  mcolor(red) msymbol(D) msize(large) ) ///
	(educthree, keep(2.educthree#c.highpm)   ciopts(recast(rcap) lcolor(orange%30))  mcolor(orange) msymbol(D) msize(large) ) ///
	(educthree, keep(3.educthree#c.highpm)  ciopts(recast(rcap) lcolor(gold%30)) mcolor(gold) msymbol(D) msize(large)  )  ///
	 ,  /// 
	drop(weighted*)  ///
			     vertical levels(95) yline(0)   legend(off)      ///
				 coeflabels(1.educthree#c.highpm = "< College" ///
                2.educthree#c.highpm = "Bachelor" ///
			  3.educthree#c.highpm = "Post-graduate" ///
			   ) nooffsets omitted baselevels
	
	graph export $Results/byeducation.png, replace
	
	
		
		
